import 'package:audio_waveforms/audio_waveforms.dart';
import 'package:getx_scaffold/common/index.dart';

class AudioPlayerController extends ChangeNotifier {
  Duration _value = Duration.zero;

  Duration get position => _value;

  set position(Duration value) {
    _value = value;
    notifyListeners();
  }

  // 初始化播放器控制器
  PlayerController? playerController;

  setPlayerController(PlayerController playerController) {
    this.playerController = playerController;
  }

  // 快进
  Future<void> setForward(Duration duration) async {
    try {
      await playerController?.seekTo(duration.inMilliseconds);
    } catch (e) {
      log('Error fast forwarding: $e');
    }
  }

}
